package com.joinway.framework.support.session;

public class SessionProvider {

	private static ISessionModel model = new HttpSessionModel();
	
	public SessionProvider(ISessionModel model){
		SessionProvider.model = model;
	}
	
	/**
	 * 从session获取值
	 * @param key
	 * @param type
	 * @return
	 */
	public static <T> T getValue(String key, Class<T> type) {
		return model.get(key, type);
	}

	public static void setValue(String key, Object value) {
		model.set(key, value);
	}
	
	public static void remove(String key){
		model.remove(key);
	}
	
	public static String getSessionId() {
		return model.getId();
	}
	
	public static void invalidateSession(){
		model.invalidate();
	}
	
}
